package plugin_demo;

import android.os.Bundle;
import android.widget.Toast;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * This class echoes a string called from JavaScript.
 */
public class Demo extends CordovaPlugin {

    @Override
    public void initialize(CordovaInterface cordova, CordovaWebView webView) {
        super.initialize(cordova, webView);
        Toast.makeText(cordova.getActivity(), "测试 初始化方法 initialize", Toast.LENGTH_LONG).show();
    }

    @Override
    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
		// action = "coolMethod";
        Toast.makeText(cordova.getActivity(), "测试 执行方法 execute", Toast.LENGTH_LONG).show();
        return super.execute(action, args, callbackContext);
    }

    @Override
    public Bundle onSaveInstanceState() {
        Toast.makeText(cordova.getActivity(), "测试 保存数据 onSaveInstanceState", Toast.LENGTH_LONG).show();
        return super.onSaveInstanceState();
    }

    @Override
    public void onStart() {
        super.onStart();
    }
}
